package cn.edu.swu.miniwebsvr;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Main {

    private static Scanner scanner = new Scanner(System.in);
    private static ImageManger imageManger = new ImageManger();

    public static void main(String[] args) {
        run();
    }

    private static void run() {
        printTitle();
        int choice;
        while (true){
            try {
                choice = scanner.nextInt();

                switch (choice){
                    case 1:
                        System.out.println(1);
                        break;
                    case 2:
                        System.out.println(2);
                        break;
                    case 3:
                        System.out.println(3);
                        break;
                    case 4:
                        printTitle();
                        break;
                    case 5:
                        System.out.println(4);
                        return;
                    default:
                        System.out.println("d");
                }

            }catch (InputMismatchException e){
                System.out.println("输入格式错误：请输入整数！！");
                scanner.nextLine();
            }catch (Exception e){
                System.out.println("未知错误：" + e.getMessage());
                scanner.nextLine();
            }
        }
    }

    private static void printTitle(){
        System.out.println("=== 图片下载系统 ===");
        System.out.println("输入数字选项（1~4）进行操作");
        System.out.println("1. 下载图片");
        System.out.println("2. 查看所有图片");
        System.out.println("3. 搜索图片");
        System.out.println("4. 退出");
        System.out.println("您的选择是？");
    }


}
